Skip to main content

Asset Bundling

https://laravel.com/docs/10.x/vite

New to laravel 10 - npm run dev on production server?

Hi all, I have just started getting back into laravel (last time I actively used it, still a beginner though, was version 5) so this is all a big difference for me. Just going through the Whats new in 10 series and afterwards the getting started in laravel 8 series.

But my question so far is, after installing laravel with breeze scaffolding for all the auth controllers and such, I am now required to run the npm server as well, does this mean this is also required on the production server then?

What would be the best way to actually run it on the server if that's the case?

This reply was automagically generated by our local A.I. Think of it as a one-off attempt to instantly solve your problem. It will not respond to further replies.

No, it is not necessary to run npm run dev on the production server. This command is used to compile assets during development.

For production, you should run npm run prod instead, which will minify and optimize the assets for production use.

To run this command on the server, you can SSH into the server and navigate to the project directory. Then, run the following command:

Copy

npm run build

This will compile the assets and place them in the public directory, which can be served by your web server.